/**
 * Standard Team class used for both enemy and friendly.
 * 
 */
package com.rpg.battle;

import com.rpg.Drawable_I;
import com.rpg.R;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;

/**
 * @author christ66
 *
 */
public class Team implements Drawable_I{
	public Team(Context context, int startingX, int direction, Activity activity) {
		
		height = (int)(activity.getResources().getDisplayMetrics().heightPixels * 0.28);
		width = (int)(activity.getResources().getDisplayMetrics().widthPixels * 0.15);
		
		for (int i = 0; i < partySize; i++) {
			team[i] = new IndividualCharacter(context, R.drawable.crono, 100, 50);
			team[i].setStartPosition(startingX + direction * (i % 2 == 0 ? 0 : width), i * height);
		}	
	}	
	
	public void attack(int attacker, int damage, IndividualCharacter attacked) {
		team[attacker].attack(attacked);
	}
	
	
	/*
	 * (non-Javadoc)
	 * @see com.rpg.Drawable_I#onDraw(android.graphics.Canvas)
	 */
	public void onDraw(Canvas canvas) {
        for (int i = 0; i < partySize; i++) {
        		team[i].onDraw(canvas);
        }
	}
	
	public IndividualCharacter getCharacter(int character) {
		return team[character];
	}
	
	public int getPartySize() {
		return partySize;
	}
	
	private int height, width;
	private final int partySize = 3;
	private IndividualCharacter [] team = new IndividualCharacter[partySize];
}
